package mortal.game.control
{
    import com.gengine.global.*;
    import flash.events.*;
    import modules.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuideWelcomeController extends Controller
    {

        public function GuideWelcomeController()
        {
            
        }

        public function stageResize() : void
        {
            if (_view && !_view.isHide)
            {
                (_view as GuideWelcomeModule).stageResize();
            }
            
        }

        private function onWindowShow(event:WindowEvent) : void
        {
            Global.stage.addEventListener(MouseEvent.CLICK, this.onStageClickHandler);
            
        }

        private function onWindowClose(event:WindowEvent) : void
        {
            Global.stage.removeEventListener(MouseEvent.CLICK, this.onStageClickHandler);
            Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_BeginGame, true));
            
        }

        private function onStageClickHandler(event:MouseEvent) : void
        {
            _view.hide();
            
        }

        override protected function initView() : IView
        {
            var _loc_1:* = new GuideWelcomeModule();
            _loc_1.addEventListener(WindowEvent.SHOW, this.onWindowShow);
            _loc_1.addEventListener(WindowEvent.CLOSE, this.onWindowClose);
            _loc_1.layer = LayerManager.guideLayer;
            return _loc_1;
        }

        override protected function initServer() : void
        {
            
        }

    }
}
